package com.ruoyi.keep.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.keep.domain.TpcEvaluation;
import com.ruoyi.keep.service.ITpcEvaluationService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 课程评价标签Controller
 * 
 * @author yipeng
 * @date 2024-08-14
 */
@RestController
@RequestMapping("/keep/evaluateTag")
public class TpcEvaluationController extends BaseController
{
    @Autowired
    private ITpcEvaluationService tpcEvaluationService;

    /**
     * 查询课程评价标签列表
     */
    @PreAuthorize("@ss.hasPermi('keep:evaluateTag:list')")
    @GetMapping("/list")
    public TableDataInfo list(TpcEvaluation tpcEvaluation)
    {
        startPage();
        List<TpcEvaluation> list = tpcEvaluationService.selectTpcEvaluationList(tpcEvaluation);
        return getDataTable(list);
    }

    /**
     * 导出课程评价标签列表
     */
    @PreAuthorize("@ss.hasPermi('keep:evaluateTag:export')")
    @Log(title = "课程评价标签", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TpcEvaluation tpcEvaluation)
    {
        List<TpcEvaluation> list = tpcEvaluationService.selectTpcEvaluationList(tpcEvaluation);
        ExcelUtil<TpcEvaluation> util = new ExcelUtil<TpcEvaluation>(TpcEvaluation.class);
        util.exportExcel(response, list, "课程评价标签数据");
    }

    /**
     * 获取课程评价标签详细信息
     */
    @PreAuthorize("@ss.hasPermi('keep:evaluateTag:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tpcEvaluationService.selectTpcEvaluationById(id));
    }

    /**
     * 新增课程评价标签
     */
    @PreAuthorize("@ss.hasPermi('keep:evaluateTag:add')")
    @Log(title = "课程评价标签", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TpcEvaluation tpcEvaluation)
    {
        return toAjax(tpcEvaluationService.insertTpcEvaluation(tpcEvaluation));
    }

    /**
     * 修改课程评价标签
     */
    @PreAuthorize("@ss.hasPermi('keep:evaluateTag:edit')")
    @Log(title = "课程评价标签", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TpcEvaluation tpcEvaluation)
    {
        return toAjax(tpcEvaluationService.updateTpcEvaluation(tpcEvaluation));
    }

    /**
     * 删除课程评价标签
     */
    @PreAuthorize("@ss.hasPermi('keep:evaluateTag:remove')")
    @Log(title = "课程评价标签", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tpcEvaluationService.deleteTpcEvaluationByIds(ids));
    }
}
